package com.prezs.Javaio;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;

public class StreamTest {
	
	static List<String> list;
	
	static {
		list =  new ArrayList<>();
		list.add("周杰伦");
        list.add("王力宏");
        list.add("陶喆");
        list.add("林俊杰");
	}
	
	public static void testFilterStream() {
		Stream<String> stream =  list.stream().filter(element -> element.contains("力"));
		stream.forEach(System.out::println);
	}
	
	public static void testMapStream() {
		list.stream().map(String::length).forEach(System.out::println);
	}
	
	public static void main(String[] args) {
		testFilterStream();
		
		testMapStream();
	}
}
